//
// CPSEmitter.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.IStream;

public class CPSEmitter {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CPSEmitter(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CPSEmitter obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CPSEmitter(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public long getType() {
    return nel3dJNI.CPSEmitter_getType(swigCPtr, this);
  }

  public long getPriority() {
    return nel3dJNI.CPSEmitter_getPriority(swigCPtr, this);
  }

  public boolean hasEmitters() {
    return nel3dJNI.CPSEmitter_hasEmitters(swigCPtr, this);
  }

  public void step(TPSProcessPass pass) {
    nel3dJNI.CPSEmitter_step(swigCPtr, this, pass.swigValue());
  }

  public void computeSpawns(long firstInstanceIndex) {
    nel3dJNI.CPSEmitter_computeSpawns(swigCPtr, this, firstInstanceIndex);
  }

  public void doEmitOnce(long firstInstanceIndex) {
    nel3dJNI.CPSEmitter_doEmitOnce(swigCPtr, this, firstInstanceIndex);
  }

  public void showTool() {
    nel3dJNI.CPSEmitter_showTool(swigCPtr, this);
  }

  public boolean setEmittedType(CPSLocated et) {
    return nel3dJNI.CPSEmitter_setEmittedType(swigCPtr, this, CPSLocated.getCPtr(et), et);
  }

  public void notifyTargetRemoved(CPSLocated ptr) {
    nel3dJNI.CPSEmitter_notifyTargetRemoved(swigCPtr, this, CPSLocated.getCPtr(ptr), ptr);
  }

  public CPSLocated getEmittedType() {
    long cPtr = nel3dJNI.CPSEmitter_getEmittedType__SWIG_0(swigCPtr, this);
    return (cPtr == 0) ? null : new CPSLocated(cPtr, false);
  }

  public boolean setEmissionType(CPSEmitter.TEmissionType freqType) {
    return nel3dJNI.CPSEmitter_setEmissionType(swigCPtr, this, freqType.swigValue());
  }

  public CPSEmitter.TEmissionType getEmissionType() {
    return CPSEmitter.TEmissionType.swigToEnum(nel3dJNI.CPSEmitter_getEmissionType(swigCPtr, this));
  }

  public void setPeriod(float period) {
    nel3dJNI.CPSEmitter_setPeriod(swigCPtr, this, period);
  }

  public float getPeriod() {
    return nel3dJNI.CPSEmitter_getPeriod(swigCPtr, this);
  }

  public boolean usePeriodScheme() {
    return nel3dJNI.CPSEmitter_usePeriodScheme(swigCPtr, this);
  }

  public void setPeriodScheme(SWIGTYPE_p_NL3D__CPSAttribMakerT_float_t scheme) {
    nel3dJNI.CPSEmitter_setPeriodScheme(swigCPtr, this, SWIGTYPE_p_NL3D__CPSAttribMakerT_float_t.getCPtr(scheme));
  }

  public SWIGTYPE_p_NL3D__CPSAttribMakerT_float_t getPeriodScheme() {
    long cPtr = nel3dJNI.CPSEmitter_getPeriodScheme__SWIG_0(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NL3D__CPSAttribMakerT_float_t(cPtr, false);
  }

  public void setEmitDelay(float delay) {
    nel3dJNI.CPSEmitter_setEmitDelay(swigCPtr, this, delay);
  }

  public float getEmitDelay() {
    return nel3dJNI.CPSEmitter_getEmitDelay(swigCPtr, this);
  }

  public boolean setMaxEmissionCount(short count) {
    return nel3dJNI.CPSEmitter_setMaxEmissionCount(swigCPtr, this, count);
  }

  public short getMaxEmissionCount() {
    return nel3dJNI.CPSEmitter_getMaxEmissionCount(swigCPtr, this);
  }

  public void setGenNb(long GenNb) {
    nel3dJNI.CPSEmitter_setGenNb(swigCPtr, this, GenNb);
  }

  public long getGenNb() {
    return nel3dJNI.CPSEmitter_getGenNb(swigCPtr, this);
  }

  public boolean useGenNbScheme() {
    return nel3dJNI.CPSEmitter_useGenNbScheme(swigCPtr, this);
  }

  public void setGenNbScheme(SWIGTYPE_p_NL3D__CPSAttribMakerT_unsigned_int_t scheme) {
    nel3dJNI.CPSEmitter_setGenNbScheme(swigCPtr, this, SWIGTYPE_p_NL3D__CPSAttribMakerT_unsigned_int_t.getCPtr(scheme));
  }

  public SWIGTYPE_p_NL3D__CPSAttribMakerT_unsigned_int_t getGenNbScheme() {
    long cPtr = nel3dJNI.CPSEmitter_getGenNbScheme__SWIG_0(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NL3D__CPSAttribMakerT_unsigned_int_t(cPtr, false);
  }

  public void serial(IStream f) {
    nel3dJNI.CPSEmitter_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void setSpeedInheritanceFactor(float fact) {
    nel3dJNI.CPSEmitter_setSpeedInheritanceFactor(swigCPtr, this, fact);
  }

  public float getSpeedInheritanceFactor() {
    return nel3dJNI.CPSEmitter_getSpeedInheritanceFactor(swigCPtr, this);
  }

  public void enableSpeedBasisEmission(boolean enabled) {
    nel3dJNI.CPSEmitter_enableSpeedBasisEmission__SWIG_0(swigCPtr, this, enabled);
  }

  public void enableSpeedBasisEmission() {
    nel3dJNI.CPSEmitter_enableSpeedBasisEmission__SWIG_1(swigCPtr, this);
  }

  public boolean isSpeedBasisEmissionEnabled() {
    return nel3dJNI.CPSEmitter_isSpeedBasisEmissionEnabled(swigCPtr, this);
  }

  public void enableUserMatrixModeForEmissionDirection(boolean enable) {
    nel3dJNI.CPSEmitter_enableUserMatrixModeForEmissionDirection__SWIG_0(swigCPtr, this, enable);
  }

  public void enableUserMatrixModeForEmissionDirection() {
    nel3dJNI.CPSEmitter_enableUserMatrixModeForEmissionDirection__SWIG_1(swigCPtr, this);
  }

  public boolean isUserMatrixModeForEmissionDirectionEnabled() {
    return nel3dJNI.CPSEmitter_isUserMatrixModeForEmissionDirectionEnabled(swigCPtr, this);
  }

  public void setUserMatrixModeForEmissionDirection(TPSMatrixMode matrixMode) {
    nel3dJNI.CPSEmitter_setUserMatrixModeForEmissionDirection(swigCPtr, this, matrixMode.swigValue());
  }

  public TPSMatrixMode getUserMatrixModeForEmissionDirection() {
    return TPSMatrixMode.swigToEnum(nel3dJNI.CPSEmitter_getUserMatrixModeForEmissionDirection(swigCPtr, this));
  }

  public void singleEmit(long index, long quantity) {
    nel3dJNI.CPSEmitter_singleEmit(swigCPtr, this, index, quantity);
  }

  public void enableConsistenEmission(boolean enable) {
    nel3dJNI.CPSEmitter_enableConsistenEmission(swigCPtr, this, enable);
  }

  public boolean isConsistentEmissionEnabled() {
    return nel3dJNI.CPSEmitter_isConsistentEmissionEnabled(swigCPtr, this);
  }

  public void releaseRefTo(CParticleSystemProcess other) {
    nel3dJNI.CPSEmitter_releaseRefTo(swigCPtr, this, CParticleSystemProcess.getCPtr(other), other);
  }

  public void releaseAllRef() {
    nel3dJNI.CPSEmitter_releaseAllRef(swigCPtr, this);
  }

  public void setBypassAutoLOD(boolean bypass) {
    nel3dJNI.CPSEmitter_setBypassAutoLOD(swigCPtr, this, bypass);
  }

  public boolean getBypassAutoLOD() {
    return nel3dJNI.CPSEmitter_getBypassAutoLOD(swigCPtr, this);
  }

  public static void setBypassEmitOnDeath(boolean bypass) {
    nel3dJNI.CPSEmitter_setBypassEmitOnDeath(bypass);
  }

  public static boolean getBypassEmitOnDeath() {
    return nel3dJNI.CPSEmitter_getBypassEmitOnDeath();
  }

  public boolean checkLoop() {
    return nel3dJNI.CPSEmitter_checkLoop(swigCPtr, this);
  }

  public boolean testEmitForever() {
    return nel3dJNI.CPSEmitter_testEmitForever(swigCPtr, this);
  }

  public void setOwner(CPSLocated psl) {
    nel3dJNI.CPSEmitter_setOwner(swigCPtr, this, CPSLocated.getCPtr(psl), psl);
  }

  public boolean getUserMatrixUsageCount() {
    return nel3dJNI.CPSEmitter_getUserMatrixUsageCount(swigCPtr, this);
  }

  public void setEmitTrigger() {
    nel3dJNI.CPSEmitter_setEmitTrigger(swigCPtr, this);
  }

  public void updateEmitTrigger() {
    nel3dJNI.CPSEmitter_updateEmitTrigger(swigCPtr, this);
  }

  public final static class TEmissionType {
    public final static TEmissionType regular = new TEmissionType("regular", nel3dJNI.CPSEmitter_regular_get());
    public final static TEmissionType onDeath = new TEmissionType("onDeath", nel3dJNI.CPSEmitter_onDeath_get());
    public final static TEmissionType once = new TEmissionType("once", nel3dJNI.CPSEmitter_once_get());
    public final static TEmissionType onBounce = new TEmissionType("onBounce", nel3dJNI.CPSEmitter_onBounce_get());
    public final static TEmissionType externEmit = new TEmissionType("externEmit", nel3dJNI.CPSEmitter_externEmit_get());
    public final static TEmissionType numEmissionType = new TEmissionType("numEmissionType");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TEmissionType swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TEmissionType.class + " with value " + swigValue);
    }

    private TEmissionType(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TEmissionType(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TEmissionType(String swigName, TEmissionType swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TEmissionType[] swigValues = { regular, onDeath, once, onBounce, externEmit, numEmissionType };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
